“One of the most practical ways to eliminate a bad habit is to reduce exposure to the cue that causes it.”
You cannot really erase the bad habit. It will be always there. However, you can remove the cues from your life, and the habit will not be triggered. The research shows that once you remove the cues, there is a much lower chance that you will come back to bad habits, such as addictions. It’s not always easy. Sometimes it means that you have to change your neighborhood, your job, or even your friends.