1: 2: 3: 4:
select t.SaleID, t.OtherFields , dbo.YourFunction(t.SaleID, @companyID) x FROM yourtable t WHERE t.companyid = @companyID