This is basically your code, I just corrected the variable declaration and added the stored procedure DDL. It works as it is.
If it doesn't work, make sure that you're using SQL Server and not a different RDBMS.
CREATE PROCEDURE MyStoredProc
DECLARE @Results INT;
EXEC @Results = MyStoredProc;
IF @Results IS NOT NULL
PRINT 'OK thanks';
DROP PROCEDURE MyStoredProc;
Luis C.How to post data/code on a forum to get the best help: Option 1 / Option 2
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?