Hi @Northface
Please check this:
DECLARE @sql_str NVARCHAR(MAX)
DECLARE @spread_elements NVARCHAR(MAX)
SELECT @spread_elements = ISNULL(@spread_elements + ',','') + QUOTENAME(concept)
FROM #t1
GROUP BY concept
SELECT @sql_str = 'select t1.concept,x.* from(select concept,''''as col from #t1)t PIVOT(max(col) for concept in ( ' + @spread_elements + ')) x
cross join #t1 t1 order by concept'
PRINT @sql_str
EXECUTE sp_executeSQL @sql_str;
Best regards,
LiHong