Some SQL commands, including ‘CREATE’ or ‘DROP’, cannot be executed without knowledge of the database architectural design of its tables. Therefore, to determine the count of columns in a specific table one should check the INFORMATION_SCHEMA.COLUMNS view and/or the sys.columns catalog in SQL Server. These two processes give you the ability to limit the output to the required table and specify the total number of columns in it. This comes in handy when the designer has to be concerned about the already existing tables within the system and their specific structures.
SELECT COUNT(*) AS ColumnCount
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'your_table_name';
SELECT COUNT(*) AS ColumnCount
FROM sys.columns
WHERE object_id = OBJECT_ID('your_table_name');