Hello saint
I would suggest to use XML. After selection of data you can simply transform it with XSLT to HTML.
Here a little example
IF (OBJECT_ID('tempdb..#test') IS NOT NULL)
DROP TABLE #test
CREATE TABLE #test (id INT, first_name NVARCHAR(100), last_name NVARCHAR(100))
INSERT INTO #test VALUES (1, 'Mikey', 'Mouse')
INSERT INTO #test VALUES (1, 'Hoomer', 'Simpson')
SELECT *
FROM #test t
FOR XML AUTO
DROP TABLE #test
Greets
Flo