I assume you would be using an ADO recordset to get the query results? If so, the recordset object has a Fields collection which you can iterate through. If say, you wanted to output the field names as column headers you could use the Name property of each field, then the actual data would be output using the Value property. Something like this:
Code:
' code here to run query, get recordset back and check it has data
Dim fld
Response.Write "<table><tr>"
' write out col headings
For Each fld in recordsetName.Fields
Response.Write "<td>"
Response.Write fld.Name
Response.Write "</td>"
Next
Response.Write "</tr>"
' write out col data
Do While Not recordsetName.EOF
Response.Write "<tr>"
For Each fld in recordsetName.Fields
Response.Write "<td>"
Response.Write fld.Value ' maybe deal with Nulls here too
Response.Write "</td>"
Next
Response.Write "</tr>"
recordsetName.MoveNext
Loop
hth
Phil