A habit, once created, stays in our brain for ever. We can 'overwrite' it with a new, better one, but still, in the end, it will stay there in our head.
Sometimes, an old bad pattern can come back, even after a really long time. If the circumstances are similar to those associated with the habit, its likely it will occur automatically, without our control.
Old patterns come back, especially when we think we've just beaten them. After coming out of a bad habit, there is usually a second wave, when it hits us hard. We can't resist - all the patterns are back; the feelings, the thoughts, and, eventually, the behavior itself.
Don't be afraid of old patterns coming back; use it as a signifier of your progress. Talk about them, make them visible. You have to know your enemy before the fight.
Remember to do one thing: always, always strive for finding and building newer, better ones.