//the name of the stored proc is TEST1
SqlCommand myCommand = new SqlCommand("TEST1", myConnection);
//Tell the command its a stored procedure, not regular SQL
myCommand.CommandType = CommandType.StoredProcedure;
//Add a parameter to the command
int i=0;
myCommand.Parameters.AddWithValue("@result",i);
//tell it that this parameter is a return value, not a regular inbound parameter
myCommand.Parameters["@result"].Direction = ParameterDirection.ReturnValue;
//now execute
try
{
myCommand.ExecuteNonQuery();
//nor retrieve the value in the return parameter.
i = (int)myCommand.Parameters["@result"].Value;