Finally got this working- I've tried following this article http://blog.oneunicorn.com/2012/04/21/code-first-building-blocks/ (by Arthur Vickers on the entity framework team) to tell the DbContext to use the sql 2005 syntax- So when I build the context I do this;
var builder = new DbModelBuilder();
builder.Entity<PossibleDuplicateCustomer>();
var model = builder.Build(new DbProviderInfo("System.Data.SqlClient", "2005"));
_compiledSql2005Model = model.Compile();
// OverdriveDbContext : DbContext
var context = new OverdriveDbContext(
nameOrConnectionString: "OverdriveConnectionString",
model: _compiledSql2005Model);
This now executes the following SQL;
exec sp_executesql N'EXEC SearchPotentialDuplicates @CustomerId, @FirstName, @LastName, @dob',N'@CustomerId int,@FirstName nvarchar(4),@LastName nvarchar(3),@dob datetime',@CustomerId=12645,@FirstName=N'adam',@LastName=N'ant',@dob='1951-11-01 00:00:00'
which works perfectly in SQL 2005. A word of caution though- MiniProfiler (which I'm using to monitor entity framework calls) incorrectly shows the sql executed as:
DECLARE @CustomerId int = 12645,
@FirstName nvarchar(4) = N'adam',
@LastName nvarchar(3) = N'ant',
@dob datetime = '1951-11-01T00:00:00'
EXEC SearchPotentialDuplicates @CustomerId, @FirstName, @LastName, @dob
which stopped me noticing that I'd fixed this for a few hours! So the lesson there is MiniProfiler's SQL monitoring is no substitute for good old Sql Profiler!