On the first look - if statement in sp is incorrect.
It should look like:
DECLARE @flag BIT = NULL
IF (@flag IS NULL)
PRINT 'Flag is null!'
In case when there is more than 1 line after
if
statement, you have to "wear" this in
BEGIN .. END
statement.
IF (@flag IS NULL)
BEGIN
PRINT 'Flag is null!'
PRINT 'Please stop passing null values!'
END
See:
IF...ELSE (Transact-SQL)[
^]
Note: please, read
F-ES Sitecore[
^] comment to the question.