в одну сторону
select count(*) from sys.columns
другой
select count(*) from information_schema.columns
В нижней части нет системных таблиц
по таблице
select count(*),table_name from information_schema.COLUMNS
GROUP BY table_name
только таблицы
select count(*),c.table_name
from information_schema.COLUMNS c
JOIN information_schema.tables t ON c.TABLE_NAME = t.TABLE_NAME
AND c.TABLE_Schema = t.TABLE_Schema
WHERE TABLE_TYPE = 'base table'
GROUP BY c.table_name
только просмотр
select count(*),c.table_name
from information_schema.COLUMNS c
JOIN information_schema.tables t ON c.TABLE_NAME = t.TABLE_NAME
AND c.TABLE_Schema = t.TABLE_Schema
WHERE TABLE_TYPE = 'view'
GROUP BY c.table_name