If i understand you well...
Replace this:
where b.BusinessName = @SEARCH and
a.City = @loc
OR a.State = @loc
and b.BusinessName LIKE '%' + @SEARCH + '%'
with:
where (b.BusinessName LIKE '%' + @SEARCH + '%' and (a.City = @loc OR a.State = @loc))
unless you want to fetch data when one of possible conditions is meet:
where ((b.BusinessName = @SEARCH and a.City = @loc)
OR (a.State = @loc and b.BusinessName LIKE '%' + @SEARCH + '%'))
[EDIT]
As to the OP's comments... i would suggest to create dynamic queries. See:
Building Dynamic SQL In a Stored Procedure[
^]
Using Dynamic Queries[
^]
[EDIT 2]
Assuming that you want to display data in ascending order, you have to add
ORDER BY
clause:
SELECT *
FROM TableName
WHERE <condition>
ORDER BY FieldName