Declare temporary Table
declare @tmpJobs table(Id int,
LocationId int,
CategorySectorId int)
insert into @tmpJobs(Id, LocationId, CategorySectorId)
select intAd_id, locationid, categorysectorid
from fnJobAlertOptionsBySiteID(@SiteID)
--use temporary table
Select tj.LocationId
,tj.CategorySectorId
From @tmpJobs tj