При использовании динамического поворота это может быть опция.
DECLARE @cols AS NVARCHAR(MAX),
@query AS NVARCHAR(MAX);
SET @cols = STUFF((SELECT distinct ',' + QUOTENAME(c.column_name)
FROM your_table_name c
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)')
,1,1,'')
set @query = 'SELECT RPT_ID, FILE_ID, LINE_ID' + @cols + ' from
(
select RPT_ID
, FILE_ID
, LINE_ID
, column_values
, column_name
from your_table_name
) x
pivot
(
max(column_values)
for column_name in (' + @cols + ')
) p '
execute(@query)