Kindly refer the below link, It is **T-Sql Server 2005** question. for adding dynamic columns in a temporary table. Here 2 temp tables are there as tabl1 and table2 and result is in "output table". here my rows are getting converted in columns. Using plain pivot I am not able to achive this.One Person from this forum only has helped me but now the reqiriment has changed now. **Kindly see the below link.**
Microsoft SQL Server · TSQL · · ·
Duplicate thread, cross posted from here. Closing..