dude...i can totally relate to you...well maybe not the sex sex sex part hahaha...but, I, myself is a church goer and i love to go to church because it cleansing for me and it encourages me to be a better person. you are not a bad person. the only thing you could do is to try to eliminate those thoughts or try to limit them. maybe the other thing is that you need to release it.
it may sound weird but once youve released that pressure, all the dirty thoughts normally goes away.
but i can totally identify myself with you.