I think I see what you're getting at. You could create a temp table with all the column names in it, using a select from sys.columns. Then update that table with the column counts that you want. From there it's a select from the temp table and build your report as usual.