comes with prayer and experience. i don't think i can just ask god to make me wise no matter what and everything i do and say from that point on will be so wise and awesome and correct people will travel for miles to seek my advice. we all know they should, but i'm realistic, i know they won't. ;) and i know it won’t happen overnight. my wisdom grows usually the most through mistakes i make - and they can be painful but god uses all my life circumstances to mold and mature me.
i have seen it happen more often than i like in the church when older people 