IF(
(@FCCPROCESSSTATUS <>0 AND NOT(@FCCPROCESSSTATUS = 2 AND ISNULL(@DCCFLOWVERSION,0) = 2))
--(@FCCPROCESSSTATUS <>0 AND NOT(@FCCPROCESSSTATUS = 2 AND @DCCFLOWVERSION = 2))
OR (@FOREIGNAMOUNT IS NOT NULL)
)
BEGIN
Print 'DCCFlow : ' + cast( @DCCFLOWVERSION as varchar(10)) + '!!'
END
ELSE
BEGIN
Print 'DCCFlow : nothing '
END
NOTE: when @DCCFLOWVERSION is nothing(not null) , the first branch will not be reached!!!!
so the fix is the line highlighted in RED.