Good advice from Mari.
Don‘t wish to sound discouraging in any way and ofcourse there are always exceptions, but on the whole, cockers are pullers and, although with patience and lots of practice you can often get the behaviour to a manageable level, I think most people on here would agree that its rare for them to walk happily to heel in all circumstances.
In our case, its worse when Humphrey‘s excited, somewhere new or if we‘re in a group (he‘s far easier if its just him and me). He‘s nearly 5 now and I think the turning point for me was, as Mari says, finally accepting that that is the way they are. Looking back, I feel sorry that I was working against him and aiming for perfection all the time (shouting „heel“ every few minutes) instead of just relaxing, giving him chance to sniff and then jollying him along while praising and treating and keeping him focused. You can even stop and give a sit or down command in between, - it’ll all help to keep him focused and motivated. Try and vary the places you go aswell, they‘ll walk perfectly in one place where you‘ve practised a lot and as soon as you go somewhere else its all forgotten.
There are lots of methods shown on line and in books and I‘ve tried most of them at various stages but again, agree with Mari‘s approach as that worked best for us. Attitude has a lot to do with sucesss, try and stay as relaxed as possible (Not always easy, I know), be consistent and positive and above all, keep praising when he gets its right.
Best of luck!