Since nobody else is providing a solution I'll give it a try. I am simplifying the query against sys.columns because I don't really understand what you are doing. That said, you can use my example as a template and rearrange the query that feeds the table accordingly.
WITH x1(xxx) AS
SELECT TOP(10) td1 = name, td2 = column_id, td3 = max_length
FOR xml path('tr'),ROOT('table')
'<table>','<table cellpadding="2" cellspacing="2" border="1">'
) AS XML
Edit: code formatting issue.
"I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."
-- Itzik Ben-Gan 2001