Check if the next example can be adjusted for your needs:
drop table if exists #data
select *
into #data
from @data
declare @cols varchar(max) = stuff((
select ',' + quotename([date])
from #data
order by [date]
for xml path('')
), 1, 1, '')
declare @sql varchar(max) = concat(
'select ', @cols, '
from (
select [date], Field1, Field2, Field3, Field4
from #data
) t
unpivot
(
v for f in (Field1, Field2, Field3, Field4)
) u
pivot
(
max (v) for [date] in (', @cols, ')
) p')
exec (@sql)
You can also try STRING_AGG instead of XML.
If you have a real table, then use it directly instead of @alrt and #data.