Sometimes you get a situation where a long-standing stored procedure seems to have started misbehaving. Either unexpected records are returned or expected records are omitted. Perhaps the procedure appears to freeze without completing.
The procedure seems to work correctly using Query Analyser in your test environment but in the live environment with the live application things do not appear to be working correctly.
The article continues at