Patenting Costs article: How much does it cost to get a patent? $5-8k total (US Patent issued), depending on what kind (design or utility), how complex, and in which countries patent protection is sought.
Patenting software, is the same as patenting anything else, and, it can all be done online from the comfort of your home or workshop. The complex nature of the requirements means you might want professional help.
Patent Agent Legal Services? When it comes to legal rights, in pertinent part, property rights, there are licensed professionals who offer help in exercising or protecting your rights. Lawyers. For patents there are patent practitioners (agent or attorney) to deal with these special rights.