What is the safe way to update production data if data found inconsistent I am in a small company and require to fix a bunch of data in production which are inconsistent.  I have written the script to handle the fix. 

I understand that writing sql to fix data is way more risky than working on fixes normal front end or backend code. For front end or back end, we can write thousands of test code to automatically test result or even little bug the affect might not be as dramatic. 

How do you guys fix the data in production normally if many data was inconsistent? Are there any method or strategy which can reduce the risk
How do you guys fix the data in production 


Very very carefully!

This may be too general a question: there are many variables involved regarding data size, error severity, how active that data is, what service level agreements you have with the client, ...

Some tips:


Test the scripts in your dev/test environments as extensively as time allows.
If you can, take a copy of the production system to test the scripts on. You probably need to do this on production services if your application handles PPI or other sensitive data.
If you have an upcoming maintenance window when you can offline the production environment to test and apply the change (and rollback the DB if something goes wrong).
If there is time in that window take a fresh copy of production database to retest before applying to production proper.
Take a backup of production, so you can rollback if the update fails and makes more mess.
Apply the change to production and test that the result is as desired.
If all is well, drop the extra test copies and turn production back on, if not rollback to your backups and try again...


Of course if the data fix needs to be made more urgently, you may need to be much less cautious than the above list.