title: Stored procedure returns int instead of result set
body: <p>I have a stored procedure that contains dynamic select. Something like this:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[usp_GetTestRecords] 
      --@p1 int = 0, 
      --@p2 int = 0
      @groupId nvarchar(10) = 0
  AS
  BEGIN
      SET NOCOUNT ON;
  
      DECLARE @query  NVARCHAR(max)
  
      SET @query = 'SELECT * FROM CUSTOMERS WHERE Id = ' + @groupId
      /* This actually contains a dynamic pivot select statement */
  
      EXECUTE(@query);
  END
  </code></pre>
  
  <p>In SSMS the stored procedure runs fine and shows result set.</p>
  
  <p>In C# using Entity Framework it shows returning an <code>int</code> instead of <code>IEnumerable</code>?</p>
  
  <pre><code>private void LoadTestRecords()
  {
      TestRecordsDBEntities dataContext = new TestRecordsDBEntities();
      string id = ddlGroupId.SelectedValue;
  
      List&lt;TestRecord&gt; list = dataContext.usp_GetTestRecords(id); //This part doesn't work returns int
      GridView1.DataSource = list;
  }
  </code></pre>
  
  <p>Generated function for <code>usp_GetTestRecords</code></p>
  
  <pre><code>public virtual int usp_GetTestRecords(string groupId)
  {
      var groupIdParameter = groupId != null ?
          new ObjectParameter("groupId", groupId) :
          new ObjectParameter("groupId", typeof(string));
  
      return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_GetTestRecords", groupIdParameter);
  }
  </code></pre>