I work at a company where one group in IT makes AngularJS apps, another writes industry machine learning models, and a few others are using Lotus Notes.
The highest margin software consultancy I ever saw was specialized in maintaining legacy sw applications, running on setups that were popular in the late 80s and early 90s. A little niche, but extremely high margin.