SQL Server stored procedure keeps restoring to previous one
A common problem when developers involves the schema that SQL Server assumes when creating or altering an object. This is especially likely in the following circumstances:


The developer has recently been removed from the db_owner role The
developer is working on a server that they normally don't. 
They are likely to see the problem on a production server (where their
permissions are tightly controlled) rather than a development server (where they might be a member of db_owner or even sysadmin).


This problem is often described by developers as "SQL Server is using the old version of my proc". What really happens is that the developer is modifying a copy of the procedure and executing a different copy of the procedure.

The quick way out of this is to ensure that you are providing a schema for the stored procedure with your drop, create, alter and execute statements. In SQL Server, the vast majority of the time, that schema is "dbo". In other words, prefer this:

alter procedure dbo.foo
as
select 1
go 
exec dbo.foo


and avoid this:

alter procedure foo
as
select 1
go 
exec foo