Like most of us, we have our highs and lows. Similarly when it comes to habit, that same denomination applies. Having a good habit is great. Keep that up. But on the other end, having bad ones, not so much. If you have been toying with the idea to change that, then perhaps this might be of interest to you.
You see, habits, both good and bad are the result of a process. You are definitely not born with a habit. You consciously or most of the time, unconsciously create one. So in order to change it, you need to dissect it. Analyse the situations and factors leading you up to the bad habit. Yes, you definitely need to sit yourself down for this one. Block a piece in your daily schedule to do this. And be honest with yourself. Be blunt about it. Do not censor yourself when doing this. Anyways, it is just for your eyes only. Once you have clearly defined the situations and factors, you are already getting closer to changing your bad habit.
By doing such, you are being clear with yourself of the steps and actions that you can then on take to effectively improve yourself.
So next step, is to simply engineer the process so that you win. Cut the factors that lead you to the bad habit. Or get yourself away from your situations that usually end you up there. It does require a little trial and error. But be sure, that if you keep tweaking and reanalysing the process, you will eventually get your bad habits out of your system.