Update procedures.sql

Optimized the update, no need to count every message each time.
(can take a lot of time on big Databases)