To change the habit, we must be self-aware. In Tara Bennett-Goleman's new book, " Mind Whispering" the neuroscience of habit change is explained. She recommends mindfulness as a way to bring unconscious habits back into awareness where they can be changed with a five-step process for making that change.
1) Familiarize yourself with the self-defeating habit. Get so you can recognize the routine as it starts, or begins to take over. This might be by noticing its typical thoughts or feelings, or how you start to act. You can also follow Paul Ekman's simple suggestion: keep a journal of your triggers.
2) Be mindful. Monitor your behavior –thoughts, feelings, actions – from a neutral, “witness” awareness.
3) Remember the alternatives – think of a better way to handle the situation.
4) Choose something better – e.g., what you say or do that would be helpful instead of self-defeating.
5) Do this at every naturally occurring opportunity.
Ms. Bennett-Goleman cites the neuroscience evidence that the more often you can repeat the new routine instead of the self-destructive one, the sooner it will replace the self-defeating habit in your basal ganglia. The better response will become your new default reaction. Good luck with this. It's worth the time and energy investment.