Colonoscopy is a very safe endoscopic procedure. It is very unlikely that it is the cause of your long standing rectal pain. It does cause abdominal discomfort during the procedure itself, but this almost always disappears in a day or two.