Hi,
Try this one....
CREATE PROC PR_TEST_OP_NEW
(
@myString as varchar(100)
)
AS
BEGIN
declare @mSQL NVARCHAR(200)
DECLARE @CNT AS INT
SET @mSQL='
SELECT @CNT= ' + @myString
Print(@mSQL)
EXEC sp_executesql
@mSQL,N'@CNT INT OUTPUT',@CNT OUTPUT
SELECT @CNT
if @CNT > 0
BEGIN
Print('Done')
END
ELSE
BEGIN
Print('Not Done')
END
END
Hope this will help you.
Also, go through this
sp_executesql[
^]
Cheers