OriginalGriff has mentioned a nice link.
but I think you want to check you SP in parts in SSMS.(Not in your code) like "exec spname"
so you can use return for this purpose.
ALTER FUNCTION [dbo].[islistthere]
(
@ent char(4), @Id int, @month char(4), @sec int
)
RETURNS char(5) AS
BEGIN
DECLARE @Table1 int
DECLARE @Table2 int
DECLARE @Add char(5)
SET @Add = 'false'
SET @Table1 = ( SELECT COUNT(PRID) FROM PR WHERE PRID = @Id and ent = ltrim(rtrim(@ent)) and TMonth=@month)
select @Table1
return -- it will return from here and would not execute other statements
SET @Table2 = ( SELECT COUNT(PRDID) FROM PRD WHERE PRID = @Id andent = ltrim(rtrim(@ent)) and TMonth=@month and TSec=@sec)
IF (@sec = 0 AND @Table1 = 0 )
SET @Add = 'true'
IF (@sec > 0 AND @Table1 = 1 AND @Table2 = 0 )
SET @Add = 'true'
RETURN @Add
END
but once you done with checking don't forget to remove these extra "return" from your sp, Otherwise it will give error/wrong output.