It depends. If you care about only the original developers' convenience, then stick any logic in any layer. If you care about users and any maintenance programmers, then you put the display logic in the aspx layer. Why?
1) If the performance is troublesome, additional web servers can be added a lot easier than additional database servers.
2) The application is easier to understand, as each layer has predictable purposes.
I am not sure I buy that the logic in VB would be all that difficult to create. Heck. It just seems to me it would be a few more if statements to detect if a header has changed, so long as the output of the query has been ordered properly.
You will notice that your dynamic pivot table produces different column headers each time you run it, whereas a normal view or stored procedure outputs a data set that has a reliable and consistent schema.
Interfaces need this consistency in order to map local objects to database values. Your dynamic pivot table thus has little use to reporting tools and interfaces, which could very well have performed the pivoting themselves.
The fact that interfaces have difficulty processing and parsing formatted data is one of the most important reasons why this formatting should not be done in the database.
If it's not practically useful, then it's practically useless.