ERCP (endoscopic retrograde cholangiopancreatography) is a procedure used to treat the small intestine. Through the endoscope, the physician can see the inside of the stomach and duodenum, and inject dyes into the ducts in the biliary tree and pancreas so they can be seen on x-rays.