So, the database I was talking about is located at:
~/Library/Group Containers/group.com.apple.usernoted/db2
However, that is the one that feeds the Notification Center itself. If ones dismisses a notification from Messages via the Notification Center, but does not open the message itself, then the count would be off between what remains in the Notification Center database and the actual number of the Messages' alert badge.For example, one could have 3 notifications in the Notification Center belonging to Messages, but one could still have 20 unchecked text messaged. Thus, my suggestion wouldn't actually solve the problem.
Though, there may be another database one could check that I am unaware of.