CREATE procedure AAspEAI @xmlparam
as
declare @qry varchar(1000)
set @qry = 'select distinct a.providerkey,lastname,firstname,middlename,descr as AddressType,address1,address2,city,state,zipcode
from provider a
inner join productprovider b on a.providerkey = b.providerkey
inner join clinicproduct c on b.clinickey = c.clinickey and b.contractkey = c.contractkey and b.productcodeid = c.productcodeid
inner join clinicaddress d on c.clinicproductkey = d.clinicproductkey
inner join lookup e on locationtypeid = lookupid
where where a.providerkey = ' + @xmlparam
print @qry
exec (@qry)
is it correct.