How to create stored procedure in sql server and call that procedure from C# code behind with some parameters to that procedure
<p>I am trying to create the following stored procedure in sql server Lat and Lng are the parameters being passed from c# code behind .But I am not able to create this stored procedure
it indicates with error saying undefined column name Lat,Lng</p>

<pre><code>CREATE FUNCTION spherical_distance(@a float, @b float, @c float)
RETURNS float
AS
BEGIN
    RETURN ( 6371 * ACOS( COS( (@a/@b) ) * COS(  (Lat/@b)  ) * COS( ( Lng/@b ) - (@c/@b) )  + SIN( @a/@b ) * SIN(  Lat/@b  ) ) )    
END
</code></pre>

<p>This is my query from c# code behind.</p>

<pre><code>sqlda.SelectCommand.CommandText = "select *, spherical_distance( Lat, 57.2958, Lng) as distance
                                     from business 
                                    where (( distance &lt; '" + radius + "' )
                                      and (StreetName like '%" + streetname + "%')
                                      and (Keyword like '%" + keyword1 + "%' )) 
                                 order by spherical_distance(Lat,57.2958,Lng)";
</code></pre>

<p>This is the view clause</p>

<pre><code>create view [dbo].[business] as 
SELECT Id,
       Name1,
       ZipCode,
       StreetName,
       StreetNumber,
       State1,
       Lat,
       Lng,
       Keyword
  FROM Business_Details
</code></pre>
