• Take a look at this article, Script to create dynamic PIVOT queries in SQL Server[/url]. It should have what you need.

    😎