CREATE PROCEDURE GetCustomerCountByCity
@City nvarchar(75),
@Count int OUTPUT
AS
BEGIN
DECLARE @sqlCommand nvarchar(1000);
SET @sqlCommand = N'SELECT @Count = COUNT(*) FROM customers WHERE City = @City';
EXECUTE sp_executesql @sqlCommand, N'@City nvarchar(75), @Count int OUTPUT',
@City = @City, @Count = @Count OUTPUT;
END
Using Above query to get respective output