Get the number of columns in the table
Use [yourdatabaseName]
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_name = 'yourtableName'
OR
SELECT COUNT(*)
FROM yourdatabaseName.sys.columns
WHERE object_id = OBJECT_ID('yourdatabaseName.dbo.yourtableName')