• Take a look at the blog from Aaron Bertrand where he builds a dynamic PIVOT solution:

    http://www.mssqltips.com/sqlservertip/2783/script-to-create-dynamic-pivot-queries-in-sql-server/

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **