I have the following stored proc


@searchKey varchar(100), 
@model varchar(100),
@category int,
@availability int,
@minPrice money  = 0.00,
@maxPrice money = 100000.00


declare @finalCategory varchar(20)
declare @finalAvailability varchar(20)

if @category = 0
      select @finalCategory = "IS NOT NULL"
      select @finalCategory = '=' + @category

if @availability = 0
       select @finalAvailability = "IS NOT NULL";
       select @finalAvailability = '=' + @availability;

select distinct p.product_id, pi.product_image_imagedir, p.product_title, p.product_price 
from product p 
right join product_link pl on p.product_id = pl.product_link_pid
left join product_image pi on p.product_id = pi.product_image_pid
where (((p.product_title like @searchKey) or (p.product_description like @searchKey))
or (p.product_model = @model)
and (pl.product_link_cid  @finalCategory ) 
and (p.product_availability  @finalAvailability)
and ((p.product_price >= @minPrice) and (p.product_price <= @maxPrice))
order by p.product_title, p.product_price desc;
my problem is SQL Server is screaming at me about @finalCategory and @finalAvailability where I use it at the end of the stored proc. Says it is invalid syntax. What I am doing essentially is if the value of @availability = 0 I want the proc to select any rows in the p.product_availability else use the assigned value to filter results and the same thing for the @category. so technically what I need to do is connect the 2 strings inside the actual query.