• If it is a paramater sniffing option and you are using SQL2008 you can use the Query Hint OPTION(RECOMPILE) on the offending SELECT statement, which should solve the issue and give you and indication if this is the case.

    As the previous poster suggested try to avoid using WITH RECOMPILE on functions an SP's as that can cause more problems.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices