When I execute the Stored procedure below I am getting blank rows. It executes with no errors and I get prompted for a year, just not returning data. I'm pretty sure its because my parameter in the stored procedure is not getting passed down to:where year(inv_dt)=@YEARIf I replace @YEAR with 2002 I get data. ALTER PROCEDURE [dbo].[MonthlySales] -- Add the parameters for the stored procedure here @YEAR intASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure hereDECLARE @listCol VARCHAR(2000)DECLARE @query VARCHAR(4000)SELECT @listCol = STUFF(( SELECT DISTINCT '],[' + ltrim(str(Month(inv_dt))) FROM oehdrhst_sql ORDER BY '],[' + ltrim(str(Month(inv_dt))) FOR XML PATH('') ), 1, 2, '') + ']'SET @query ='Declare @YEAR intSELECT * FROM (SELECT cus_no,slspsn_no, Month(inv_dt) OrderYear, tot_sls_amt FROM oehdrhst_sql where year(inv_dt)=@YEAR ) srcPIVOT (SUM(tot_sls_amt) FOR OrderYearIN ('+@listCol+')) AS pvt' EXECUTE (@query)END