I don't understand why the following is giving me the error. I thought it was related to the commented out section, but @SQL is nvarchar(4000).
BEGIN
sp_executesql N'SELECT ''td'''
--sp_executesql @SQL, N'@StartDate DateTime, @EndDate DateTime, @End2 DateTime, @Program varchar(4)', @StartDate, @EndDate, @End2, @Program
END