Not sure where the error is but I think it is this line
- convert(datetime,Agreement_enddate,101)
Test by removing that line.
I can't see why you are converting to a datetime.
Surely it already exists as such.
To remove any ambiguity rename the alias 'Agreement_enddate' to something else.