Welcome to HealthcareMagic forum
you seems to have gastroenteritis
. take some antacids and you will be relived. for sever pain the cause is imp, it can be renal stone(as you told is comes and go), colic
, stomach ulcer
etc. You should go for USG if the condition is not relived with analgesics.
I hope I answered your query. Wish you good health.