Compensation of tool wear by adapting program to profile of tool