You need to take control your thoughts. You would protect yourself from rocks falling on your head. Well, you need to do the same thing with your thoughts. Say a prayer, ask God for guidance and wisdom and then write up a few (well maybe lots) of positive comments about yourself. Put them in an empty Kleanix box and draw one out each time a negative thought enters your mind. Of course you might have to carry around that box for a while, but it is important to over power those thoughts.
This is why my answer to the casually uttered statement, "Have a nice day," is usually, "I will, because it is my choice and I choose to have a nice day today, I hope you do to."