just a comment, in the syscolumns table there's another way to get the names and easier for me to remember
instead of querying the table as you do, you could also use the OBJECT_ID function wich does the same as the subquery you use there
SELECT name FROM syscolumns WHERE ID = OBJECT_ID('XYZ')
Jose Torres