title: Like operator on input parameters in stored procedure
body: <p>I've just begun to add writing stored procedures to my SQL repertoire and I'm sure this is a noob question.  Can someone point me in the right direction about how to use the <code>like</code> operator instead of the <code>=</code> operator in this scenario?  The object of this is to find the first 3 common numbers out of a potential 5 digit number</p>
  
  <p>stored procedure:</p>
  
  <pre><code>create proc dbo.MultipleDrugs (@condition varchar(50))
  as
  SELECT  *, 100.0 * round(SUM(numwithanxiety) OVER (partition BY sex) / cast(TotalSexCounts AS float), 4) overAllPercentByGender
  FROM (SELECT x.sex, injurylevel, SUM(sexandlevelcounts) OVER (partition BY x.sex) numByInjury, sum(sexandlevelcounts) AS numWithAnxiety, 
        100.0 * round(cast(sexandlevelcounts AS float) / SUM(sexandlevelcounts) OVER (partition BY x.sex), 4) AS percentWith, y.TotalSexCounts
        FROM (SELECT sex, injurylevel, COUNT(*) AS sexAndLevelCounts
               FROM (SELECT DISTINCT m.patid, m.sex, m.injurylevel
                FROM  members AS m INNER JOIN
                 icdClm AS ic ON ic.patid = m.PATID
                 --*****when I leave this operator as like and use
                 --*****equals in the exec statement it works
                 WHERE ic.icd LIKE @condition) t
                GROUP BY sex, injurylevel) x INNER JOIN
                (SELECT m.sex, COUNT(DISTINCT patid) TotalSexCounts
                  FROM members m
                  GROUP BY m.sex) y ON y.sex = x.sex
                 GROUP BY x.sex, x.injuryLevel, x.sexAndLevelCounts, y.TotalSexCounts) rr
   go
  </code></pre>
  
  <p>This runs, but I cannot use the <code>like</code> operator </p>
  
  <pre><code>exec dbo.MultipleDrugs  N'70700'
  </code></pre>
  
  <p>This is what I'd like to do</p>
  
  <pre><code>exec dbo.MultipleDrugs  like '707%'
  </code></pre>