Sounds like a possible fissure, or tear, in the rectum. Fissures can cause extremely sharp pain - like someone sticking a knife up the rectum. Sometimes it's constant pain, but other times, it may come and go, like yours. You should go to a doctor to find out for sure what's going on.
DX: mild to moderate Crohn's for 34 years
Additional benefits: chronic anemia, B12 deficient, peripheral neuropathy, facial mylagsia, joint pain, underactive thyriod
Current meds: Colozal, Nexium, Entocort, Flagyl, steriod cream, monthly B12 injections, Neurontin, Synthroid, Effexor ER, pain meds as needed