You could do
SqlCommand cmd = new SqlCommand("EXEC sp_helptext @spname");
cmd.Parameters.AddWithValue("@spname", "dbo.StoredProcedureName");
But using
SqlCommand cmd = new SqlCommand("sp_helptext");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@objname", "dbo.StoredProcedureName");
is a better choice