Are you getting any errors when you run the stored procedure? or is the problem that you are not getting the results you expect or no results at all?
I normally debug more complex procedures by commenting out all but a small section of the procedure and then running it and if it works enable the next section.
If you post the procedure it will be easier to help.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question