It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "If a person intends to do a good deed and then does it, ten good deeds are written for him as a reward. If he does not do the good deed, then a single good deed is written for him merely for the intention. And if a person intends to commit a sin and then does it, one sin is written against him. But if he does not commit the sin after intending it, then a single good deed is written for him."
Hadith Referenceمسند احمد / ومن مسند بني هاشم / 3402