Browsing with dynamic columns in SQL Server
2 answers
This is not possible with a view because SQL Server queries are always statically typed in the sense that both columns, names, and types are statically known at runtime.
Dynamic columns require dynamic SQL.
Views do not support dynamic SQL. You should find another way to return the data, perhaps with one row in each logical column.
+4
source to share