Assuming that the fn_GetOrgIdList returns a table then surely You're better doing something.
INSERT INTO @table(ID)
SELECT Table2.ID
FROM Table2 WITH(NOLOCK)
JOIN dbo.fn_GetOrgIdList(@StrId) org on org.<col>=Table2.ParentId
You might get an optimisation from also doing
IF (Select REP from Table1 Where Id=@strId)=1
BEGIN
END
Those are just a couple of ideas, but without knowing what fn_getOrfIdList(@var) does its difficult to advise.
_________________________________________________________________________
SSC Guide to Posting and Best Practices