You can perform this via a PIVOT. You can use either a static PIVOT where you know the number of columns that you want to rotate or you can use a dynamic PIVOT
Static Pivot (see SQL Fiddle with Demo)
SELECT *
FROM
(
select *
from t1
) x
pivot
(
min(columnc)
for columnb in ([X], [Y])
) p
Dynamic Pivot (see SQL Fiddle with Demo)
DECLARE @cols AS NVARCHAR(MAX),
@query AS NVARCHAR(MAX);
select @cols = STUFF((SELECT distinct ',' + QUOTENAME(columnb)
from t1
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)')
,1,1,'')
set @query = 'SELECT columna, ' + @cols + ' from
(
select *
from t1
) x
pivot
(
min(ColumnC)
for ColumnB in (' + @cols + ')
) p '
execute(@query)
Both versions will give the same results. The second works when you have an unknown number of columns that will be transformed.