Sorry for crappy title..

I have a stored proc(p\_1) that returns values: OPEN or CLOSED, 

Now what I want to do is write another stored proc(p\_2) that looks into my database (audit.dbo) at a column targetDate and if p\_1 is open and over the Target date (audit.dbo) then it should return 'Overdue' or 'On Time' 

Now my question is should I match Audit\_ID with stored proc(p\_1)'s Audit\_ID to see whether its over due or not. My Stored proc result is: 

> 
> AUD\_ID: 1 Q1:10 Q2:30 Q3:40 Total:80 Status: Open
> 
> 
> 

And my database table (audit.dbo) data is something like

> 
> AUD\_ID:1 Start\_date:2013/12/03 Target\_date: 2014/01/24
> 
> 
> 

**My Proc Definition**

```
ALTER PROCEDURE [dbo].[p_GetSocre] 
AS 
BEGIN 
 SET NOCOUNT ON; 

   CREATE TABLE #tmp1( AUD_ID BIGINT, RowCounter BIGINT, DistinctCounter BIGINT
                    , NACounter BIGINT, Total BIGINT, [Status] VARCHAR(MAX) ) 

  INSERT INTO #tmp1 EXEC [p_GetCompleteIncompleteNaOverviewSCORE] 

  SELECT [Status] AS [Open/Closed], COUNT(*) AS [Status] 
  FROM #tmp1 
  GROUP BY [Status] 
END 

```