>>select RowID, [1] as Column1, [2] as Column2 from myTable PIVOT (Min(ID) for ColumnID in ([1],[2])) pvt>>
declare @t table (Id int primary key, ColumnId uniqueidentifier, RowId uniqueidentifier) insert into @t values (1, NEWID(), NEWID()),(2, NEWID(), NEWID()),(3, NEWID(), NEWID()),(4, NEWID(), NEWID()) select * from @t