I have created a winforms application which pulls data from a database. During development, (using a SQL server on the same machine), but once released, there seems to be a significant delay retrieving the data from the remote server. The dev and release servers have almost identical data, so that shouldn't be an issue.
I think that I have narrowed the problem down to one call to a stored procedure.
Using the SQL Profiler on the release server, it shows that it takes almost 17 seconds to run the stored proc, when it is called from my application, but only a tiny fraction of this when run from SSMS:
My question is, what could be causing this behavior? Or what can I do next to try and diagnose the problem further?