using(SqlConnection conn = new SqlConnection("Data
Source=localhost;Database=Northwind;Integrated Security=SSPI"))
{
SqlCommand command = new SqlCommand("spName", conn);
command.CommandType = CommandType.StoredProcedure;
conn.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["ProductName"]);
}
}
If you want to pass input parameters you can pass
command.Parameters.Add("@inputPar", SqlDbType.Int).Value = 1;
SqlDbType is enum you can choose desirable data type to pass as input parameter and its value.