Saaiduna Abu Saaed ul-Khudri Radiallahu Anhu narrates that he heard the Prophet of Allah Sallallahu Alahi Wasalam say ‘When someone amongst you sees a good and pleasing dream, he should know that it is from Allah, and so he should praise and thank Allah, and describe to others what he saw in his dream. But if he sees something that he dislikes then it is from Shaitan, so he should seek refuge from Allah (SWA) from its evil and should not mention it to anyone’. (Sahih Bukhari p.1034 v.2)
The following ahadith have been taken from Imam Nawawi’s Riyadhus Saliheen with regards to seeing a bad or scary dream.
Saaiduna Abu Qatadah Radiallahu Anhu reports that the Prophet of Allah Sallallahu Alahi Wasalam has said, “A good vision (dream) is from Allah and a bad dream is from the Satan. He who sees something in a dream that he dislikes, should blow thrice on his left, must seek Allah’s Refuge from the evil of the Satan (i.e., by saying: A`udhu billahi minash-Shaitanir-Rajim). Then it will not harm him.” (Sahih Bukhari and Sahih Muslim).
Saaiduna Jabir Radialahu Anhu reports that the Prophet of Allah (PBUH) said, “When one of you sees a bad dream let him blow three times on his left, seek refuge in Allah from the Satan three times (i.e., by saying: A`udhu billahi minash-Shaitanir-Rajim) and change the side on which he was lying.”
(Sahih Muslim) (Extracted from Riyadhus Saliheen p.245)
http://islamqa.org/hanafi/daruliftaa-birmingham/19396