select count(*) as FieldCount from syscolumns where id = (select id from sysobjects where name='TableName')