Unless I am missing something, you don't need to use UNPIVOT
for this and you don't need to use a temp table, just query the data directly. It looks like your current query is only unpivoting one column which is not needed. You use unpivot to convert multiple columns into multiple rows.
You should be able to use:
DECLARE @colsPivot AS NVARCHAR(MAX),
@query AS NVARCHAR(MAX)
select @colsPivot = STUFF((SELECT ',' + QUOTENAME(rce.EcoDate)
from PhdRpt.RptCaseEco_542 AS rce
group by rce.EcoDate
order by rce.EcoDate
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)')
,1,1,'')
set @query
= 'select *
from
(
SELECT cc.CaseCaseId AS CaseId,
cc.Label AS CaseName,
rce.EcoDate,
cc.OperatorName,
cc.State,
cc.County,
ei.IROR,
rce.NDCash
FROM PhdRpt.ReportCaseList_542 AS rcl
INNER JOIN CaseCases AS cc
ON rcl.CaseCaseId = cc.CaseCaseId
INNER JOIN PhdRpt.RptCaseEco_542 AS rce
ON rcl.ReportRunCaseId = rce.ReportRunCaseId
INNER JOIN PhdRpt.EcoIndicators_542 AS ei
ON rcl.ReportRunCaseId = ei.ReportRunCaseId
) x1
pivot
(
max(NDCash)
for EcoDate in ('+ @colspivot +')
) p'
exec(@query)