Assuming countrecordspertablepercolumn is required, the following result was found.
BEGIN and END - avoids the need to create a stored procedure and saving it on a database): IF OBJECT_ID('usp_CountRecordsPerTablePerColumn', 'P') IS NOT NULL DROP PROCEDURE [usp_CountRecordsPerTablePerColumn]; GO CREATE PROCEDURE...