>What is the select statement vs stored procedure in question?
I was running a Select statement in a query to display the result on the screen and ran the same Select statement in a Stored Procedure in order to automate the process. I used to get different results every time I run it. After many trials I realized that the prefix "sp_ " of a name stored procedure is a reserved prefix for SQL. The "sp_ " prefix is reserved for system stored procedures in the Master database only. So I had to change the prefix of the name of my user-defined stored procedure to something like "p_ " and that solved the problem.
Thanks.